﻿Imports System.Transactions
Imports Sistema_InformacionNaviera.BE
Imports Sistema_InformacionNaviera.DALC

Public Class DiasLibresBC
    Public Function ListaDiasLibres(ByVal objDLibresBE As DiasLibresBE) As List(Of DiasLibresBE)

        Dim objDLibres As List(Of DiasLibresBE) = Nothing
        Dim objDLibresDALC As DiasLibresDALC = Nothing

        objDLibresDALC = New DiasLibresDALC
        objDLibres = New List(Of DiasLibresBE)()
        objDLibres = objDLibresDALC.ListaDiasLibres(objDLibresBE)

        Return objDLibres
    End Function 

    Public Function ListaDiasLibEdicion(ByVal objDLibresBE As DiasLibresBE) As DiasLibresBE

        Dim objDLibres As DiasLibresBE = New DiasLibresBE
        Dim objDLibresDALC As DiasLibresDALC = Nothing

        objDLibresDALC = New DiasLibresDALC 
        objDLibres = objDLibresDALC.ListaDiasLibEdicion(objDLibresBE)

        Return objDLibres
    End Function

    Public Function InsertarDiasLibres(ByVal objDLibresBE As DiasLibresBE) As Integer

        Dim objScope As TransactionScope
        objScope = New TransactionScope
        Dim iKacu As Integer = 0
        Dim bExito As Boolean = False
        Using objScope
            Try
                Dim objDLibres As List(Of DiasLibresBE) = Nothing
                Dim objDLibresDALC As DiasLibresDALC = Nothing

                objDLibresDALC = New DiasLibresDALC
                objDLibres = New List(Of DiasLibresBE)()
                iKacu = objDLibresDALC.InsertarDiasLibres(objDLibresBE)


                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return iKacu
    End Function

    Public Function ModificarDiasLibres(ByVal objDLibresBE As DiasLibresBE) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope 
        Dim bExito As Boolean = False
        Using objScope
            Try
                Dim objDLibres As List(Of DiasLibresBE) = Nothing
                Dim objDLibresDALC As DiasLibresDALC = Nothing

                objDLibresDALC = New DiasLibresDALC
                objDLibres = New List(Of DiasLibresBE)()
                bExito = objDLibresDALC.ModificarDiasLibres(objDLibresBE)


                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function EliminarDiasLibres(ByVal objDiasLibresBE As DiasLibresBE, bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope

        Using objScope
            Try
                Dim objDLibresDALC As DiasLibresDALC = Nothing
                objDLibresDALC = New DiasLibresDALC

                bExito = objDLibresDALC.EliminarDiasLibres(objDiasLibresBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function
End Class
